home *** CD-ROM | disk | FTP | other *** search
- Path: qualcomm.com!usenet
- From: nabbasi@qualcomm.com (Nasser Abbasi)
- Newsgroups: comp.lang.ada,comp.lang.c++,comp.lang.c
- Subject: Re: C++ vs Ada for large project
- Date: 9 Feb 1996 13:57:14 GMT
- Organization: QUalcomm Inc.
- Message-ID: <4ffjrq$i8k@qualcomm.com>
- References: <w4wx5wc1a2.fsf@cln46ac>
- NNTP-Posting-Host: annex-p26.qualcomm.com
- X-Newsreader: WinVN 0.90.4
-
- In article <w4wx5wc1a2.fsf@cln46ac>, pascalo@cln46ac (Pascal OBRY) says:
- >
- >
- >Nasser,
- >
- >> It seems to me the most important part to have a language
- >> considered suitable for large applications is the ability to
- >> separate the interface from the implementation and things like
- >> separate compilation. and to a lesser extent the ability
- >> to do code reuse through taking advantage of inheritance
- >> (i.e. child classes can share code from common parent class as an
- >> example) or though use of generic packages or templates.
- >>
- >
- >I don't want to start a language war there but there is no such
- >feature in C++. A convention is that filename.hh contain the
- >interface for filename.cc but nothing more. You can, and in many
- >project I've seen it has been done, add some variables or functions
- >in the .hh that has nothing to do with the package and are implemented
- >in another .cc.
- >
- >I know that you speak about ability but the important thing is that
- >it should be enforced by the language. That way you can rely on your
- >software (you know that nobody has done something wrong).
-
- Let me make sure I understand you.
-
- example: in C++, one does
-
- file: classtype.h
- class classType{ public: foo(); } ; // interface declaration
-
- file: classtype.cxx
- classType::foo()
- { ... some code ...} // implementation
-
- You are saying that in classtype.h file, one can add things like
- function declarations that has nothing to do with the logical
- functionality of the class:
-
- file: classtype.h
- int some_function(); <-- this really do not belong in this file
- int global_variable; <---- since it is not used by clients to this class
- class classtype {....};
-
-
- that is correct, one can be sloppy and do this, and C++ can not
- stop you from doing this.
-
- But in Ada one can also be sloppy like the above in C++, by adding type
- definitions and subprograms specifications inside an exisiting
- package interface that logicaly do not belong there. (A term such
- as low cohesion between the package components can be used to describe
- this), and these additional entries in the package probably need to be
- collected in a separate package. So , How will Ada prevent you from
- doing this? As an example:
-
- In Ada, I can say
-
- Package File_Operations is
- procedure Open_File(..); -- open file
-
- procedure Is_Prime(...); -- find if a number is prime number
- -- This certinaly do not belong in this
- -- package
- end File_Operations;
-
- I do not see a big difference.
-
- thanks
- Nasser
-